package com.huilian.iotbox.data.enums;

import lombok.Getter;

import java.util.stream.Stream;

@Getter
public enum RoleTypeEnum {
    PLATFORM_OR_PARTNER(1,"平台、合作伙伴"),
    MERCHANT(2,"运营商"),
    ;

    private final Integer code;
    private final String desc;

    RoleTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public static RoleTypeEnum getRoleType(Integer value) {
        return Stream.of(RoleTypeEnum.values())
                .filter(p -> p.code == value)
                .findAny()
                .orElse(null);
    }
}
